VERSION 5.00 Begin VB.Form frmMain BorderStyle = 3 'Fixed Dialog Caption = "Win Detective" ClientHeight = 3225 ClientLeft = 45 ClientTop = 330 ClientWidth = 4680 Icon = "frmMain.frx":0000 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 3225 ScaleWidth = 4680 ShowInTaskbar = 0 'False StartUpPosition = 3 'Windows Default Begin VB.PictureBox Picture1 BorderStyle = 0 'None Height = 525 Left = 90 Picture = "frmMain.frx":000C ScaleHeight = 525 ScaleWidth = 525 TabIndex = 12 Top = 120 Width = 525 End Begin VB.Timer timMain Enabled = 0 'False Interval = 100 Left = 900 Top = 2700 End Begin VB.CommandButton cmdS Caption = "&Start" Height = 405 Left = 2190 TabIndex = 0 Top = 2760 Width = 1125 End Begin VB.CommandButton cmdMain Caption = "&Close" Height = 405 Left = 3510 TabIndex = 6 Top = 2760 Width = 1125 End Begin VB.Frame frMain Height = 2055 Left = 30 TabIndex = 1 Top = 630 Width = 4605 Begin VB.TextBox txtMain BackColor = &H8000000F& Height = 315 Index = 0 Left = 1680 Locked = -1 'True TabIndex = 10 Top = 330 Width = 2805 End Begin VB.TextBox txtMain BackColor = &H8000000F& Height = 315 Index = 1 Left = 1680 Locked = -1 'True TabIndex = 9 Top = 720 Width = 2805 End Begin VB.TextBox txtMain BackColor = &H8000000F& Height = 315 Index = 2 Left = 1680 Locked = -1 'True TabIndex = 8 Top = 1110 Width = 2805 End Begin VB.TextBox txtMain BackColor = &H8000000F& Height = 315 Index = 3 Left = 1680 Locked = -1 'True TabIndex = 7 Top = 1500 Width = 2805 End Begin VB.Label lblMain Caption = "Window Class :" Height = 285 Index = 3 Left = 120 TabIndex = 5 Top = 1560 Width = 1305 End Begin VB.Label lblMain Caption = "Window Parent :" Height = 285 Index = 2 Left = 120 TabIndex = 4 Top = 1170 Width = 1305 End Begin VB.Label lblMain Caption = "Window Caption :" Height = 285 Index = 1 Left = 120 TabIndex = 3 Top = 780 Width = 1305 End Begin VB.Label lblMain Caption = "Window Handle :" Height = 285 Index = 0 Left = 120 TabIndex = 2 Top = 390 Width = 1305 End End Begin VB.Label Label1 Caption = "Click The Button 'Start' To Activate Win Detective" Height = 255 Left = 720 TabIndex = 11 Top = 210 Width = 3795 End Attribute VB_Name = "frmMain" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub cmdMain_Click() End Sub Private Sub cmdS_Click() 'Just for enabling and disabling the timer If cmdS.Caption = "&Start" Then timMain.Enabled = True cmdS.Caption = "&Stop" cmdS.Caption = "&Start" Screen.MousePointer = vbDefault timMain.Enabled = False End If End Sub Private Sub timMain_Timer() Dim P As POINTAPI Dim hWn As Long Dim WinCap As String * 255 Dim ClName As String * 255 Dim OldParent As Long, Parent As Long 'First, get the cursor position of mouse GetCursorPos P 'WindowFromPoint returns the handle of the window under the mouse hWn = WindowFromPoint(P.x, P.y) txtMain(0).Text = hWn 'Determine the caption, using the handle we obtained above GetWindowText hWn, WinCap, 254 txtMain(1).Text = WinCap If Trim(txtMain(1).Text) = "" Then txtMain(1).Text = "[No Caption Detected]" 'Find the parent using the GetParent function. The loop is for 'detecting the Zero-th level parent of our window Parent = GetParent(hWn) Do While Parent OldParent = Parent Parent = GetParent(OldParent) If Parent Then OldParent = Parent GetWindowText OldParent, WinCap, 254 txtMain(2).Text = WinCap If Trim(txtMain(2).Text) = "" Then txtMain(2).Text = "[No Perent Detected]" 'Get the class name of our window GetClassName hWn, ClName, 254 txtMain(3).Text = ClName If Trim(txtMain(3).Text) = "" Then txtMain(3).Text = "[No Class Detected]" End Sub